home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Compilers / digital marsC compier / dm / include / Stddef.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-03-16  |  1.6 KB  |  90 lines

  1. /* Copyright (C) 1986-2001 by Digital Mars. $Revision: 1.1.1.1 $ */
  2. #if __SC__ || __RCC__
  3. #pragma once
  4. #endif
  5.  
  6. #ifndef __STDDEF_H
  7. #define __STDDEF_H 1
  8.  
  9. #if __cplusplus
  10. extern "C" {
  11. #endif
  12.  
  13. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  14. #ifndef _CRTAPI1
  15. #define _CRTAPI1 __cdecl
  16. #endif
  17.  
  18. /* Define _CRTAPI2 (for compatibility with the NT SDK) */
  19. #ifndef _CRTAPI2
  20. #define _CRTAPI2 __cdecl
  21. #endif
  22.  
  23. /* Define CRTIMP */
  24. #ifndef _CRTIMP
  25. #if defined(_WIN32) && defined(_DLL)
  26. #define _CRTIMP  __declspec(dllimport)
  27. #else
  28. #define _CRTIMP
  29. #endif
  30. #endif
  31.  
  32. #if __OS2__ && __INTSIZE == 4
  33. #define __CLIB    __stdcall
  34. #else
  35. #define __CLIB    __cdecl
  36. #endif
  37.  
  38. #if defined(_MT)
  39. extern int * __CLIB _errno(void);
  40. #define errno (*_errno())
  41.  
  42. #if __INTSIZE == 4
  43. unsigned long * __CLIB __threadid(void);
  44. #if __NT__
  45. #define _threadid    (__threadid())
  46. #else
  47.             /* MOV EAX,FS:[0Ch] */
  48. #define _threadid    ((unsigned long *)__emit__(0x64,0xA1,0x0C,0,0,0))
  49. #endif
  50. #else
  51. extern int __far * __cdecl _threadid;
  52. #endif
  53.  
  54. #else
  55. extern int __cdecl errno;
  56. #endif
  57.  
  58. typedef int ptrdiff_t;
  59. typedef unsigned size_t;
  60. #if !defined(_WCHAR_T_DEFINED)
  61. typedef unsigned short wchar_t;
  62. #define _WCHAR_T_DEFINED 1
  63. #endif
  64.  
  65. #define offsetof(t,i)    ((size_t)((char *)&((t *)0)->i - (char *)0))
  66.  
  67. #ifndef NULL
  68. #ifdef __cplusplus
  69. #define NULL 0
  70. #else 
  71. #define NULL ((void *)0)
  72. #endif 
  73. #endif 
  74.  
  75. #if __cplusplus && !__NEW_DEFINED
  76. #define __NEW_DEFINED 1
  77. extern "C++" {
  78.    void *operator new(size_t s, void *at);
  79. #if _ENABLE_ARRAYNEW
  80.    void *operator new[](size_t s, void *at);
  81. #endif
  82. }
  83. #endif
  84.  
  85. #if __cplusplus
  86. }
  87. #endif
  88.  
  89. #endif
  90.